import express from "express"
import home_ctrl from "../app/controllers/home.js"
import product_ctrl from "../app/controllers/product.js"
import auth_ctrl from "../app/controllers/auth.js"
import order_ctrl from "../app/controllers/order.js"
import auth from "../app/middleware/check_user.js"

const router = express.Router()

router.get("/login",auth_ctrl.login)
router.post("/login",auth_ctrl.doLogin)
router.get("/logout",auth_ctrl.logout)
router.get("/",home_ctrl.index)
router.get("/products", product_ctrl.allProducts)
router.get("/products/:id", product_ctrl.getProduct)
router.get("/new-product", auth, product_ctrl.new_product_form)
router.post("/new-product", auth, product_ctrl.add_product)
router.get("/orders", auth, order_ctrl.index)

export default router